<?php

class Bid_CategoryController extends My_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
        parent::init();
        $this->_helper->_layout->setLayout('2columns-left');
    }

    public function getsubcatAction()
	{
    	$this->_helper->layout()->disableLayout();
    	
    	$parent_id = $this->_request->getParam('catid');
    	$model = $this->loadModel('bid','Category');
    	$select = $model->select()->where('parent_id=?',$parent_id);
		$categories = $model->fetchAll($select);
		$this->view->categories = $categories;
		
		$select = $model->select()->where('id=?',$parent_id);
		$this->view->category = $model->fetchRow($select);
		
		$stack = array();
		$select = $model->select()->where('id=?',$parent_id);
		$tmp = $model->fetchRow($select);
		while($tmp->parent_id){
			$stack[] = $tmp->name;
			$select = $model->select()->where('id=?',$tmp->parent_id);
			$tmp = $model->fetchRow($select);
		}
		$this->view->stack = $stack;
    }
    
    public function create2Action()
    {
    }
    
    public function create3Action()
    {
    }
    
    public function create4Action()
    {
    }
}

